package com.itheima.controller;

import com.itheima.domain.Huangzhe;
import com.itheima.domain.Keshi;
import com.itheima.service.SubscribeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
@RequestMapping("/subscribe")
public class SubscribeController {

    @Autowired
    private SubscribeService service;

    @RequestMapping("/findKeshi")
    @ResponseBody
    //查询科室类别
    public List<Keshi> findKeshi() {
        List<Keshi> keshiList = service.findKeshi();
        return keshiList;
    }

    @RequestMapping("/save")
    //保存挂号信息
    public String save(Huangzhe huangzhe) {
        service.save(huangzhe);
        return "subscribe-form";
    }

}
